package wh.bos.web.action;

import javax.ws.rs.core.MediaType;

import org.apache.cxf.jaxrs.client.WebClient;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Namespace;
import org.apache.struts2.convention.annotation.ParentPackage;
import org.apache.struts2.convention.annotation.Result;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import com.opensymphony.xwork2.ActionContext;

import wh.bos.domain.take_delivery.PageBean;
import wh.bos.domain.take_delivery.Promotion;

@ParentPackage("json-default")
@Namespace("/")
@Controller
@Scope("prototype")
public class PromotionAction extends BaseAction<Promotion>{
	
	//分页查询宣传活动
	@SuppressWarnings("unchecked")
	@Action(value="promotion_pageQuery",results={@Result(name="success",type="json")})
	public String pageQuery(){
//		System.out.println(page+"..."+rows);
		//基于webService获取bos_management宣传活动的数据信息
		PageBean<Promotion> pageBean = WebClient.create
		("http://localhost:9004/service/promotionService/pageQuery?page="+page+"&&rows="+rows)
		.accept(MediaType.APPLICATION_JSON).get(PageBean.class);
		ActionContext.getContext().getValueStack().push(pageBean);
		return SUCCESS;
	}
	

	
}
